<template>
  <div class="">
         <!-- 房屋列表 -->
         <el-dialog v-model="housedialogVisible" title="Tips" width="500" :before-close="handleClose">
            <ElTable v-bind="tableConfig" @selectChange="selectChange"></ElTable>
            <el-button @click="housedialogVisible = false">取消</el-button>
            <el-button type="" @click="submitHouse">确认</el-button>
        </el-dialog>
  </div>
</template>

<script lang='ts' setup>
import { ref } from "vue"
import { gethouse } from "../service/house/house";
import ElTable, { TableType } from "../components/ELTable.vue";



const houses = ref()
// 获取已选房屋
const selectChange = (val:any) => {
    houses.value=val
    emit('selectChange',houses.value)
    console.log(houses.value,333);
}
const submitHouse = () => {
    housedialogVisible.value = false
}
//表格格式
const column = [
    { prop: 'building', lable: '房屋编号', slot: false },
    { prop: 'houseno', lable: '所属楼栋', slot: false },
]
const searchParams = ref({
    page: 1,
    psize: 6
})
const tableConfig = ref<TableType>({
    column: column,
    loadData: gethouse,
    searchParams: searchParams,
    pageConfig: {
        isShow: true,
        psize: 6
    }
})
//添加页面显示
const housedialogVisible = ref(true)
const emit = defineEmits(['close','selectChange'])
const handleClose = () => {
    housedialogVisible.value = false
    emit('close', [])
}
</script>

<style  scoped>
</style>
